hvmloader: Fix build dependency (rombios.o depends on roms.inc)
authorKeir Fraser <keir@xen.org>
Mon, 18 Apr 2011 04:01:19 +0000 (05:01 +0100)
committerKeir Fraser <keir@xen.org>
Mon, 18 Apr 2011 04:01:19 +0000 (05:01 +0100)
Also, generate roms.inc file in a scratch location and then move in
place. This is more reliable if make is terminated at an arbitrary
point.

Signed-off-by: Keir Fraser <keir@xen.org>
tools/firmware/hvmloader/Makefile

index 87c8d0e32405dca14d23cfcc47f79bd7776f5a47..9f121a469fd3b7e4a4116c3a48baf14af9f24458 100644 (file)
@@ -54,7 +54,7 @@ endif
 all: subdirs-all
        $(MAKE) hvmloader
 
-hvmloader.o: roms.inc
+rombios.o hvmloader.o: roms.inc
 smbios.o: CFLAGS += -D__SMBIOS_DATE__="\"$(shell date +%m/%d/%Y)\""
 
 hvmloader: $(OBJS) acpi/acpi.a
@@ -63,32 +63,34 @@ hvmloader: $(OBJS) acpi/acpi.a
        rm -f hvmloader.tmp
 
 roms.inc: $(ROMBIOS_ROM) $(STDVGA_ROM) $(CIRRUSVGA_ROM) ../etherboot/eb-roms.h
-       echo "/* Autogenerated file. DO NOT EDIT */" > roms.inc
+       echo "/* Autogenerated file. DO NOT EDIT */" > $@.new
 
 ifneq ($(ROMBIOS_ROM),)
-       echo "#ifdef ROM_INCLUDE_ROMBIOS" >> roms.inc
-       sh ./mkhex rombios $(ROMBIOS_ROM) >> roms.inc
-       echo "#endif" >> roms.inc
+       echo "#ifdef ROM_INCLUDE_ROMBIOS" >> $@.new
+       sh ./mkhex rombios $(ROMBIOS_ROM) >> $@.new
+       echo "#endif" >> $@.new
 endif
 
 ifneq ($(STDVGA_ROM),)
-       echo "#ifdef ROM_INCLUDE_VGABIOS" >> roms.inc
-       sh ./mkhex vgabios_stdvga $(STDVGA_ROM) >> roms.inc
-       echo "#endif" >> roms.inc
+       echo "#ifdef ROM_INCLUDE_VGABIOS" >> $@.new
+       sh ./mkhex vgabios_stdvga $(STDVGA_ROM) >> $@.new
+       echo "#endif" >> $@.new
 endif
 ifneq ($(CIRRUSVGA_ROM),)
-       echo "#ifdef ROM_INCLUDE_VGABIOS" >> roms.inc
-       sh ./mkhex vgabios_cirrusvga $(CIRRUSVGA_ROM) >> roms.inc
-       echo "#endif" >> roms.inc
+       echo "#ifdef ROM_INCLUDE_VGABIOS" >> $@.new
+       sh ./mkhex vgabios_cirrusvga $(CIRRUSVGA_ROM) >> $@.new
+       echo "#endif" >> $@.new
 endif
 
-       echo "#ifdef ROM_INCLUDE_ETHERBOOT" >> roms.inc
-       cat ../etherboot/eb-roms.h >> roms.inc
-       echo "#endif" >> roms.inc
+       echo "#ifdef ROM_INCLUDE_ETHERBOOT" >> $@.new
+       cat ../etherboot/eb-roms.h >> $@.new
+       echo "#endif" >> $@.new
+
+       mv $@.new $@
 
 .PHONY: clean
 clean: subdirs-clean
-       rm -f roms.inc acpi.h
+       rm -f roms.inc roms.inc.new acpi.h
        rm -f hvmloader hvmloader.tmp *.o $(DEPS)
 
 -include $(DEPS)